﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WordRacer.Domain.Model.Dictionaries;

namespace WordRacer.Domain.Tests.Unit.Builders
{
  public class DictionaryBuilder
  {
    private IList<string> wordsToAdd;

    public DictionaryBuilder()
    {
      wordsToAdd = new List<string>();
    }

    public DictionaryBuilder withWord(string newWord)
    {
      wordsToAdd.Add(newWord);
      return this;
    }

    public GameDictionary Build()
    {
      var dictionaryFactory = new DictionaryFactory();
      var retDictionary = dictionaryFactory.CreateGameDictionary();
      foreach (var newWord in wordsToAdd)
      {
        retDictionary.AddWord(newWord);
      }
      return retDictionary;
    }

  }
}
